using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace BookShop{
    /// <summary>
    /// Strongly-typed collection for the OrderPrediction4Store class.
    /// </summary>
    [Serializable]
    public partial class OrderPrediction4StoreCollection : ReadOnlyList<OrderPrediction4Store, OrderPrediction4StoreCollection>
    {        
        public OrderPrediction4StoreCollection() {}
    }
    /// <summary>
    /// This is  Read-only wrapper class for the OrderPrediction4Store view.
    /// </summary>
    [Serializable]
    public partial class OrderPrediction4Store : ReadOnlyRecord<OrderPrediction4Store>, IReadOnlyRecord
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }
	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }
                return BaseSchema;
            }
        }
    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("OrderPrediction4Store", TableType.View, DataService.GetInstance("BookShop"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns
                
                TableSchema.TableColumn colvarStoreID = new TableSchema.TableColumn(schema);
                colvarStoreID.ColumnName = "StoreID";
                colvarStoreID.DataType = DbType.AnsiStringFixedLength;
                colvarStoreID.MaxLength = 10;
                colvarStoreID.AutoIncrement = false;
                colvarStoreID.IsNullable = true;
                colvarStoreID.IsPrimaryKey = false;
                colvarStoreID.IsForeignKey = false;
                colvarStoreID.IsReadOnly = false;
                
                schema.Columns.Add(colvarStoreID);
                
                TableSchema.TableColumn colvarIsbn = new TableSchema.TableColumn(schema);
                colvarIsbn.ColumnName = "ISBN";
                colvarIsbn.DataType = DbType.AnsiStringFixedLength;
                colvarIsbn.MaxLength = 20;
                colvarIsbn.AutoIncrement = false;
                colvarIsbn.IsNullable = true;
                colvarIsbn.IsPrimaryKey = false;
                colvarIsbn.IsForeignKey = false;
                colvarIsbn.IsReadOnly = false;
                
                schema.Columns.Add(colvarIsbn);
                
                TableSchema.TableColumn colvarBookName = new TableSchema.TableColumn(schema);
                colvarBookName.ColumnName = "BookName";
                colvarBookName.DataType = DbType.AnsiString;
                colvarBookName.MaxLength = 50;
                colvarBookName.AutoIncrement = false;
                colvarBookName.IsNullable = true;
                colvarBookName.IsPrimaryKey = false;
                colvarBookName.IsForeignKey = false;
                colvarBookName.IsReadOnly = false;
                
                schema.Columns.Add(colvarBookName);
                
                TableSchema.TableColumn colvarMinStock = new TableSchema.TableColumn(schema);
                colvarMinStock.ColumnName = "MinStock";
                colvarMinStock.DataType = DbType.Int32;
                colvarMinStock.MaxLength = 0;
                colvarMinStock.AutoIncrement = false;
                colvarMinStock.IsNullable = true;
                colvarMinStock.IsPrimaryKey = false;
                colvarMinStock.IsForeignKey = false;
                colvarMinStock.IsReadOnly = false;
                
                schema.Columns.Add(colvarMinStock);
                
                TableSchema.TableColumn colvarMaxStock = new TableSchema.TableColumn(schema);
                colvarMaxStock.ColumnName = "MaxStock";
                colvarMaxStock.DataType = DbType.Int32;
                colvarMaxStock.MaxLength = 0;
                colvarMaxStock.AutoIncrement = false;
                colvarMaxStock.IsNullable = true;
                colvarMaxStock.IsPrimaryKey = false;
                colvarMaxStock.IsForeignKey = false;
                colvarMaxStock.IsReadOnly = false;
                
                schema.Columns.Add(colvarMaxStock);
                
                TableSchema.TableColumn colvarClassification = new TableSchema.TableColumn(schema);
                colvarClassification.ColumnName = "Classification";
                colvarClassification.DataType = DbType.AnsiStringFixedLength;
                colvarClassification.MaxLength = 10;
                colvarClassification.AutoIncrement = false;
                colvarClassification.IsNullable = true;
                colvarClassification.IsPrimaryKey = false;
                colvarClassification.IsForeignKey = false;
                colvarClassification.IsReadOnly = false;
                
                schema.Columns.Add(colvarClassification);
                
                TableSchema.TableColumn colvarAmount = new TableSchema.TableColumn(schema);
                colvarAmount.ColumnName = "Amount";
                colvarAmount.DataType = DbType.Int32;
                colvarAmount.MaxLength = 0;
                colvarAmount.AutoIncrement = false;
                colvarAmount.IsNullable = true;
                colvarAmount.IsPrimaryKey = false;
                colvarAmount.IsForeignKey = false;
                colvarAmount.IsReadOnly = false;
                
                schema.Columns.Add(colvarAmount);
                
                TableSchema.TableColumn colvarForecast1 = new TableSchema.TableColumn(schema);
                colvarForecast1.ColumnName = "Forecast1";
                colvarForecast1.DataType = DbType.Decimal;
                colvarForecast1.MaxLength = 0;
                colvarForecast1.AutoIncrement = false;
                colvarForecast1.IsNullable = true;
                colvarForecast1.IsPrimaryKey = false;
                colvarForecast1.IsForeignKey = false;
                colvarForecast1.IsReadOnly = false;
                
                schema.Columns.Add(colvarForecast1);
                
                TableSchema.TableColumn colvarForecast2 = new TableSchema.TableColumn(schema);
                colvarForecast2.ColumnName = "Forecast2";
                colvarForecast2.DataType = DbType.Decimal;
                colvarForecast2.MaxLength = 0;
                colvarForecast2.AutoIncrement = false;
                colvarForecast2.IsNullable = true;
                colvarForecast2.IsPrimaryKey = false;
                colvarForecast2.IsForeignKey = false;
                colvarForecast2.IsReadOnly = false;
                
                schema.Columns.Add(colvarForecast2);
                
                TableSchema.TableColumn colvarForecast3 = new TableSchema.TableColumn(schema);
                colvarForecast3.ColumnName = "Forecast3";
                colvarForecast3.DataType = DbType.Decimal;
                colvarForecast3.MaxLength = 0;
                colvarForecast3.AutoIncrement = false;
                colvarForecast3.IsNullable = true;
                colvarForecast3.IsPrimaryKey = false;
                colvarForecast3.IsForeignKey = false;
                colvarForecast3.IsReadOnly = false;
                
                schema.Columns.Add(colvarForecast3);
                
                TableSchema.TableColumn colvarLastMonthSale = new TableSchema.TableColumn(schema);
                colvarLastMonthSale.ColumnName = "LastMonthSale";
                colvarLastMonthSale.DataType = DbType.Int32;
                colvarLastMonthSale.MaxLength = 0;
                colvarLastMonthSale.AutoIncrement = false;
                colvarLastMonthSale.IsNullable = true;
                colvarLastMonthSale.IsPrimaryKey = false;
                colvarLastMonthSale.IsForeignKey = false;
                colvarLastMonthSale.IsReadOnly = false;
                
                schema.Columns.Add(colvarLastMonthSale);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["BookShop"].AddSchema("OrderPrediction4Store",schema);
            }
        }
        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }
	    #endregion
	    
	    #region .ctors
	    public OrderPrediction4Store()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }
        public OrderPrediction4Store(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}
			MarkNew();
	    }
	    
	    public OrderPrediction4Store(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }
    	 
	    public OrderPrediction4Store(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }
        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("StoreID")]
        [Bindable(true)]
        public string StoreID 
	    {
		    get
		    {
			    return GetColumnValue<string>("StoreID");
		    }
            set 
		    {
			    SetColumnValue("StoreID", value);
            }
        }
	      
        [XmlAttribute("Isbn")]
        [Bindable(true)]
        public string Isbn 
	    {
		    get
		    {
			    return GetColumnValue<string>("ISBN");
		    }
            set 
		    {
			    SetColumnValue("ISBN", value);
            }
        }
	      
        [XmlAttribute("BookName")]
        [Bindable(true)]
        public string BookName 
	    {
		    get
		    {
			    return GetColumnValue<string>("BookName");
		    }
            set 
		    {
			    SetColumnValue("BookName", value);
            }
        }
	      
        [XmlAttribute("MinStock")]
        [Bindable(true)]
        public int? MinStock 
	    {
		    get
		    {
			    return GetColumnValue<int?>("MinStock");
		    }
            set 
		    {
			    SetColumnValue("MinStock", value);
            }
        }
	      
        [XmlAttribute("MaxStock")]
        [Bindable(true)]
        public int? MaxStock 
	    {
		    get
		    {
			    return GetColumnValue<int?>("MaxStock");
		    }
            set 
		    {
			    SetColumnValue("MaxStock", value);
            }
        }
	      
        [XmlAttribute("Classification")]
        [Bindable(true)]
        public string Classification 
	    {
		    get
		    {
			    return GetColumnValue<string>("Classification");
		    }
            set 
		    {
			    SetColumnValue("Classification", value);
            }
        }
	      
        [XmlAttribute("Amount")]
        [Bindable(true)]
        public int? Amount 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Amount");
		    }
            set 
		    {
			    SetColumnValue("Amount", value);
            }
        }
	      
        [XmlAttribute("Forecast1")]
        [Bindable(true)]
        public decimal? Forecast1 
	    {
		    get
		    {
			    return GetColumnValue<decimal?>("Forecast1");
		    }
            set 
		    {
			    SetColumnValue("Forecast1", value);
            }
        }
	      
        [XmlAttribute("Forecast2")]
        [Bindable(true)]
        public decimal? Forecast2 
	    {
		    get
		    {
			    return GetColumnValue<decimal?>("Forecast2");
		    }
            set 
		    {
			    SetColumnValue("Forecast2", value);
            }
        }
	      
        [XmlAttribute("Forecast3")]
        [Bindable(true)]
        public decimal? Forecast3 
	    {
		    get
		    {
			    return GetColumnValue<decimal?>("Forecast3");
		    }
            set 
		    {
			    SetColumnValue("Forecast3", value);
            }
        }
	      
        [XmlAttribute("LastMonthSale")]
        [Bindable(true)]
        public int? LastMonthSale 
	    {
		    get
		    {
			    return GetColumnValue<int?>("LastMonthSale");
		    }
            set 
		    {
			    SetColumnValue("LastMonthSale", value);
            }
        }
	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string StoreID = @"StoreID";
            
            public static string Isbn = @"ISBN";
            
            public static string BookName = @"BookName";
            
            public static string MinStock = @"MinStock";
            
            public static string MaxStock = @"MaxStock";
            
            public static string Classification = @"Classification";
            
            public static string Amount = @"Amount";
            
            public static string Forecast1 = @"Forecast1";
            
            public static string Forecast2 = @"Forecast2";
            
            public static string Forecast3 = @"Forecast3";
            
            public static string LastMonthSale = @"LastMonthSale";
            
	    }
	    #endregion
	    
	    
	    #region IAbstractRecord Members
        public new CT GetColumnValue<CT>(string columnName) {
            return base.GetColumnValue<CT>(columnName);
        }
        public object GetColumnValue(string columnName) {
            return base.GetColumnValue<object>(columnName);
        }
        #endregion
	    
    }
}
